package com.yanqu.road.server.cmd.activity.dunhuangshiku;

import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.pb.dunhuangshiku.DunHuangShiKuProto;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.cross.battle.dunhuangshiku.DunHuangShiKuMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.CrossProtocol;

/**
 * @Author cwq
 * @Date 2021/04/20
 */

@Cmd(code = CrossProtocol.C2_DUN_HUANG_SHI_KU_GET_CAN_APPLY_TEAM_LIST, desc = "敦煌石窟获取可申请的队伍列表")
public class CrossDunHuangShiKuGetCanApplyTeamListCmd extends CrossUnionCommand {

    int activityId;
    int page;
    int type;
    long userId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        DunHuangShiKuProto.DunHuangShiKuGetTeamListReqMsg msg = DunHuangShiKuProto.DunHuangShiKuGetTeamListReqMsg.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        page = msg.getPage();
        type = msg.getType();
        userId = packet.getPlayerId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        MessageHelper.sendPacket(serverId, userId, YanQuMessageUtils.buildMessage(ClientProtocol.U_DUN_HUANG_SHI_KU_GET_TEAM_LIST, DunHuangShiKuMgr.getCanApplyTeamList(activityId,page,type,userId)));
    }

    @Override
    public void sendData() {

    }
}
